package cn.com.cym.gamezao.entity.grk;

import cn.com.cym.gamezao.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;


@Getter
@Setter
@NoArgsConstructor
@Entity
@Accessors(chain = true)
@Table(name ="sample_diagnose")
@ApiModel(description = "就诊信息")
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class Diagnose extends BaseEntity implements Serializable {
    private static final long serialVersionUID = -967299282800759150L;

    @ManyToOne
    @JoinColumn(name = "patient_id")
    @JsonProperty(access = JsonProperty.Access.READ_WRITE)
    private Patient patient;

    /**
     * 诊断id,不做id判断，直接写值
     */
    @Column(length = 300)
    private String diagnoseId;

    /**
     * 下次就诊时间 字典值
     */
    private String nextDiagnoseTimeId;

    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(name = "nextDiagnoseTime",value = "下次就诊时间",dataType = "LocalDate")
    private LocalDate nextDiagnoseTime;


    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(name = "diagnoseTime",value = "就诊时间",dataType = "LocalDate")
    private LocalDate diagnoseTime;

    /**
     * 主诉
     */
    @Column(length = 200)
    private String  chiefComplaint;

    /**
     * 现病史
     */
    @Column(length = 600)
    private String nowHis;

    /**
     * 既往史
     */
    @Column(length = 600)
    private String pastHis;

    /**
     * 体格检查
     */
    @Column(length = 600)
    private String healthCheck;

    /**
     * 用药
     */
    @Column(length = 50)
    private String medicine;


    /**
     * 短信提醒
     */
    private Integer remindSmsId;

    /**
     * 是否短信提醒
     */
    private Boolean isRemind;


    /**
     * 治疗方案 json
     */
    @Column(length = 600)
    private String  cures;

    /**
     *备注
     */
    @Column(length = 200)
    private String memo;

    /**
     * 检验 json
     */
    @Column(length = 2000)
    private String checkout;

    /**
     * 检查 json
     */
    @Column(length = 1000)
    private String examine;


    @OneToMany(mappedBy="diagnose",fetch = FetchType.LAZY)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private List<Sample> samples;
}
